package com.ncp.model.biz.camera;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.jsp.jstl.sql.Result;

import com.ncp.model.dao.DB;
import com.ncp.model.dao.DbConnection;
import com.ncp.model.entity.camera.CameraBean;

public class CameraBiz {
	DB common = new DB();
	
	public List<CameraBean> getCameraInfo(){
		String sql = "select cmaeraID,cmaeraName,cmaeraAddress from CAMERA";
		common.setSql(sql);
		common.setConn(DbConnection.getConnByDataSource());
		List<Object> list=new ArrayList<Object>();
		common.setList(list);
		Result rs = common.executeQuery();
		List<CameraBean> list1 = new ArrayList<CameraBean>();
		for(Map<String,Object> object: rs.getRows()){
			CameraBean cameraBean = new CameraBean();
			cameraBean.setCameraID(Integer.parseInt(object.get("CMAERAID").toString()));
			cameraBean.setCameraName(object.get("CAMERANAME").toString());
			cameraBean.setCameraAddress(object.get("CAMERAADDRESS").toString());
			list1.add(cameraBean);
		}
		return list1;
	}
}
